import {
    Platform,
    Dimensions,
    Alert
} from 'react-native';

const deviceHeight = Dimensions.get('window').height;
const deviceWidth = Dimensions.get('window').width;
const android = Platform.OS === 'android';
const iOS = Platform.OS === 'ios';
const platformStyle = undefined;


// iPhoneX
const X_WIDTH = 375;
const X_HEIGHT = 812;

const navBarHeight={
    ios:50,
    android:50
}

export {
    platformStyle,
    android,
    iOS,
    deviceWidth,
    deviceHeight,
    isIphoneX,
    navBarHeight,
    MessageAlert
};


function isIphoneX() {
    return (
        Platform.OS === 'ios' &&
        ((deviceHeight === X_HEIGHT && deviceWidth === X_WIDTH) ||
        (deviceHeight === X_WIDTH && deviceWidth === X_HEIGHT))
    )
}
function MessageAlert(error){
    Alert.alert(
        '',
        error,
        [
        //   {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
          {text: '确定', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
        //   {text: 'OK', onPress: () => console.log('OK Pressed')},
        ],
        { cancelable: false }
      )
}

